<template>
  <el-table
    :data="tableData"
    style="width: 100%">
   <el-table-column type="expand">
      <template slot-scope="props">
        <el-form label-position="left" inline class="demo-table-expand">
          <el-form-item label="商品名称">
            <span>{{ props.row.name }}</span>
          </el-form-item>
          <el-form-item label="店铺id">
            <span>{{ props.row.id }}</span>
          </el-form-item>
          <el-form-item label="店铺距离">
            <span>{{ props.row.distance }}</span>
          </el-form-item>
          <el-form-item label="店铺地址">
            <span>{{ props.row.address }}</span>
          </el-form-item>
          <el-form-item label="店铺描述">
            <span>{{ props.row.description }}</span>
          </el-form-item>
         
        </el-form>
      </template>
    </el-table-column>
  
    <el-table-column
      label="商品名称"
      prop="name">
    </el-table-column>
     <el-table-column
      label="商品名称"
      prop="address">
    </el-table-column>
    <el-table-column
      label="描述"
      prop="description">
    </el-table-column>

  </el-table>
</template>

<script>
    export default {
    data() {
      return {
      }
    },
    computed: {
        // 直接当做普通属性调用不加括号
        // 任何data中数据变化立即重新计算
        // 计算属性会缓存
        tableData:function(){
          return  this.$store.state.list  
        }
        
    },
    mounted(){
        this.$store.dispatch('shoplist')
    }
  }
</script>
<style>
  .demo-table-expand {
    font-size: 0;
  }
  .demo-table-expand label {
    width: 90px;
    color: #99a9bf;
  }
  .demo-table-expand .el-form-item {
    margin-right: 0;
    margin-bottom: 0;
    width: 50%;
  }
</style>